package cn.xxx.alumnus.controller.v1;

import org.bytesoft.compensable.Compensable;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import cn.xxx.alumnus.feginclient.v1.ApiLabelClient;
import cn.xxx.alumnus.model.entity.Label;
import cn.xxx.alumnus.service.ILabelService;
import cn.xxx.auth.feginclient.v1.ApiAccountClient;

/**
 * <p>
 * 校友标签表 前端控制器
 * </p>
 *
 * @author Mybatis Plus
 * @since 2017-10-25
 */
@RestController
@RequestMapping("/v1/label")
@Compensable(interfaceClass = ApiLabelClient.class)
public class LabelRestController implements ApiLabelClient {

    @Autowired
    private ILabelService labelService;
    @Autowired
    private ApiAccountClient accountClient;

    @Override
    @Transactional
    public String test() {
        System.out.println("执行try-----------------------------------");
        Label label = new Label();
        label.setId(10000L);
        label.setLabelType(10);
        label.setName("10000L");
        labelService.insert(label);
        accountClient.test();
        throw new RuntimeException("12121212121");
    }

    @Override
    @Transactional
    public String test1() {
        System.out.println("执行try-----------------------------------");
        Label label = new Label();
        label.setId(10000L);
        label.setLabelType(10);
        label.setName("10000L");
        labelService.insert(label);
        accountClient.test();
        throw new RuntimeException("12121212121");
    }
}